<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<!-- 当前页面css -->

		<link rel="stylesheet" type="text/css" href="$!{basePath}/content/system/h5/css/login.css" />
		<link rel="stylesheet" type="text/css" href="$!{basePath}/content/system/h5/css/mobile-ui1.0-compress.css"/>
		<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
		<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
		<script type="text/javascript" src="$!{basePath}/content/system/h5/js/mobile-ui1.0-compress.js"></script>
		<script src="$!{basePath}/app/js/vue.min.js"></script>
		<script src="$!{basePath}/app/js/axios.min.js"></script>
		<title>大医国脉</title>
	</head>
	<body>
		<div class="loginform">
			<div class="content">
			  <div class="list-block">
			    <ul>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-name"></i></div>
			          <div class="item-inner">
						<div class="item-title label">账号</div>
			            <div class="item-input">
			              <input type="text" v-model="name" placeholder="">
			            </div>
			          </div>
			        </div>
			      </li>
			      <li>
			        <div class="item-content">
			          <div class="item-media"><i class="icon icon-form-password"></i></div>
			          <div class="item-inner">
						  <div class="item-title label">密码</div>
			            <div class="item-input">
			              <input type="password" v-model="password" placeholder="">
			            </div>
			          </div>
			        </div>
			      </li>
				  <li>
					  <div class="content-block">
						  <div class="row">
							<div class="col-100"><a href="#" @click="login()" class="button button-big button-fill" >登录</a></div>
						  </div>
					   </div>
				  </li>
			   </ul>
			  </div>
			</div>
		</div>
	</body>
</html>


<script type="text/javascript">
	var app= new Vue({
		el:".loginform",
		data:{
			name:"",
			password:"",
		},
		methods:{
			login(){
				if(this.name=="" || this.password==""){
					MobileUi.init({
							type:4,
							title:'提示',
							text:'用户名或密码不能为空',
						})
				}else{
					axios.get(`$!{basePath}/app/login/login?username=${this.name}&&password=${this.password}`)
					.then( (res)=> {
						console.log(res);
						if(res.data.success) {
							if(res.data.obj != null && res.data.obj != '') {
								if(res.data.obj.needActvi == '1') {
									window.location.href = `$!{basePath}/app/login/auth?uid=${res.data.obj.uid}&jwid=${res.data.obj.jwid}&username=${this.name}`;
								} else {
									window.location.href = `$!{basePath}/system/login?username=${this.name}&password=${this.password}&jwid=${res.data.obj.jwid}`;
								}
							}


						} else {
							MobileUi.init({
								type:4,
								title:'提示',
								text: res.data.msg,
							})
						}
					})
					.catch( (error)=> {
						console.log(error);
					});
				}
			}
		}
	})
</script>